import request from '@/utils/request'

// 获取素材标签列表
const fetchMeterialTags = (params) => {
  return request({
    url: '/system/meterialTag/list',
    method: 'get',
    params
  })
}

// 删除素材标签
const deleteMeterialTag = (tagId) => {
  return request({
    url: `/system/meterialTag/${tagId}`,
    method: 'delete',
  })
}

// 新建素材标签
const createMeterialTag = (data) => {
  return request({
    url: '/system/meterialTag',
    method: 'post',
    data
  })
}

// 新建素材
const createMeterial = (data) => {
  return request({
    url: '/system/meterialItem',
    method: 'post',
    data
  })
}

//修改素材
const updateMeterial = (data) => {
  return request({
    url: '/system/meterialItem',
    method: 'put',
    data
  })
}

//获取素材列表
const fetchMeterialItemList = (params) => {
  return request({
    url: '/system/meterialItem/list',
    method: 'get',
    params
  })
}

const fetchMeterialDetailById = (id) => {
  return request({
    url: `/system/meterialItem/${id}`,
    method: 'get',
  })
}

const deleteMeterialById = (id) => {
  return request({
    url: `/system/meterialItem/${id}`,
    method: 'delete',
  })
}

export {
  fetchMeterialTags,
  deleteMeterialTag,
  createMeterialTag,
  createMeterial,
  updateMeterial,
  fetchMeterialItemList,
  fetchMeterialDetailById,
  deleteMeterialById
}